<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title></title>
		<script type="text/javascript">
			window.onload = function(){
				var btn  = document.getElementById("btn");
				var h1 = document.getElementsByTagName("h1");
				btn.onclick = function(){
					//获取属性的值
//					var res = h1[0].getAttribute('id');
//					var res = h1[0].getAttribute('class');
//					alert(res);

					//设置属性的值
					h1[0].setAttribute('name','bt');
				}
			}
		</script>
	</head>
	<body>
		<button id="btn">我是按钮</button>
		<h1 id="title" class="biaoti">我是h1标签</h1>
	</body>
</html>
